#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int y, m, d;
    int s = 0;
    int sum = 0;
    int day;
    scanf("%d/%d/%d", &y, &m, &d);
    for (s = 1;s < m;s++)
    {
        switch (s) {
        case 1:day = 31;break;
        case 2: {
            {
                if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
                    day = 29;
                else
                    day = 28;

            }
            break;
        }
        case 3:day = 31;break;
        case 4:day = 30;break;
        case 5:day = 31;break;
        case 6:day = 30;break;
        case 7:day = 31;break;
        case 8:day = 31;break;
        case 9:day = 30;break;
        case 10:day = 31;break;
        case 11:day = 30;break;
        case 12:day = 31;break;
        default:printf("error");break;

        }

        sum = sum + day;
    }
    sum += d;
    printf("%d", sum);
    return 0;
}